package com.spikything.video {
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import com.spikything.video.events.VideoEvent;
	
	
	public class VideoControlsFullscreen extends VideoControls {
		
		public function VideoControlsFullscreen(align:String, beacon:EventDispatcher, duration:int, progTitle:String, progSubtitle:String) {
			super(align, beacon, duration, progTitle, progSubtitle);
			btnFullScreen.selected = true;
			Utils.removeChild(this, mask);
			mask = null;
		}
		
		override public function onAdded (e:Event):void {
			// No intro, just appear
		}
		
		override public function fullscreenClick(e:Event):void {
			if (disabled) return;
			beacon.dispatchEvent(new VideoEvent(VideoEvent.DO_EXIT_FULLSCREEN));
		}
		
		override protected function redrawElements():void {
			super.redrawElements();
			y -= background.height + 20;
			categoryTxt.y += background.height + 75;
			titleTxt.y += background.height + 75;
			categoryTxt.x = (videoRect.width - categoryTxt.textWidth) /2
			titleTxt.x = (videoRect.width - titleTxt.textWidth) /2
		}
		
		override public function slideOut(e:Event):void {
			slide += 0.05;
			alpha = 1-slide;
			if (slide > 0.95) {
				alpha = 0;
				removeEventListener(Event.ENTER_FRAME, slideOut);
			}
		}
		override public function slideIn(e:Event):void {
			slide -= 0.05;
			alpha = 1-slide;
			if (slide < 0.05) {
				alpha = 1;
				removeEventListener(Event.ENTER_FRAME, slideIn);
			}
		}
		
	}
	
}